﻿using System;
using System.Collections.Generic;
using System.Text;
using AspNetCs.Model;
using AspNetCs.Common;
using AspNetCs.IDAL;
using System.Data;
using System.Data.SqlClient;
using AspNetCs.Config;
using System.Collections;

namespace AspNetCs.SQLServerDAL
{
    public class NetMu_DAL : INetMu
    {

        /// <summary>
        /// 生成公墓表中不存在的随机数
        /// </summary>
        /// <param name="list">不允许出现的随机数</param>
        /// <returns></returns>
        public string RndNum(ArrayList list, int Rndlen)
        {
            string Rnd = StringHelper.RndNum(Rndlen);
            for (int i = 0; i < list.Count; i++)
            {
                if (Rnd == list[i].ToString())
                {

                    Rnd = StringHelper.RndNum(Rndlen);
                    i = -1;
                }
            }
            db Conn = new db();
            try
            {

                int IsRndObj = (int)Conn.GetOneFile("Select  Count(id) from  NetMu  where  MuId='" + Rnd + "'");
                if (IsRndObj != 0)
                {
                    Rnd = RndNum(list, Rndlen);
                }

            }
            catch (Exception Ex)
            {
                new CustomException(Ex);
                Rnd = "0";
            }
            finally
            {



            }

            return Rnd;
        }

        /// <summary>
        /// 是否存在公墓编号
        /// </summary>
        /// <param name="MuId">公墓编号</param>
        /// <returns></returns>
        public bool IsExistNetMuId(string MuId)
        {
            int count = 0;
            db.ParameterArry[] paras = new db.ParameterArry[1];
            paras[0].dbType = SqlDbType.VarChar;
            paras[0].parName = "@MuId";
            paras[0].objValue = MuId;

            string cmdTex = "select count(MuId) from NetMu where MuId=@MuId";
            db dbclass = new db();

            SqlDataReader reader = dbclass.GetSqlDataReader(cmdTex, paras);
            if (reader.Read())
            {
                count = reader.GetInt32(0);
            }
            dbclass.close();
            dbclass.Dispose();
            return count > 0 ? true : false;
        }

        //添加墓
        public int AddNetMu(NetMu_Model model)
        {
            int count = 0;
            db dbclass = new db();
            string cmdText = "insert into NetMu values ({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24},{25},{26},{27},{28},{29},{30},{31},{32},{33},{34},{35},{36},{37},{38},{39},{40},{41},{42},{43},{44})";
            model.IsIntro = 0;


            db.ParameterArry[] paras = new db.ParameterArry[45];

            paras[0].dbType = SqlDbType.VarChar;
            paras[0].parName = "@MuId";
            paras[0].objValue = model.MuId;

            paras[1].dbType = SqlDbType.VarChar;
            paras[1].parName = "@MuName";
            paras[1].objValue = model.MuName;

            paras[2].dbType = SqlDbType.Int;
            paras[2].parName = "@CreateId";
            paras[2].objValue = model.CreateId;

            paras[3].dbType = SqlDbType.VarChar;
            paras[3].parName = "@surname";
            paras[3].objValue = model.Susername;

            paras[4].dbType = SqlDbType.VarChar;
            paras[4].parName = "@username";
            paras[4].objValue = model.Username;

            paras[5].dbType = SqlDbType.VarChar;
            paras[5].parName = "@otherName";
            paras[5].objValue = model.OtherName;

            paras[6].dbType = SqlDbType.VarChar;
            paras[6].parName = "@picture";
            paras[6].objValue = model.Picture;


            paras[7].dbType = SqlDbType.VarChar;
            paras[7].parName = "@Sex";
            paras[7].objValue = model.Sex;

            paras[8].dbType = SqlDbType.VarChar;
            paras[8].parName = "@nation";
            paras[8].objValue = model.Nation;

            paras[9].dbType = SqlDbType.VarChar;
            paras[9].parName = "@place";
            paras[9].objValue = model.Place;

            paras[10].dbType = SqlDbType.VarChar;
            paras[10].parName = "@Occupation";
            paras[10].objValue = model.Occupation;

            paras[11].dbType = SqlDbType.VarChar;
            paras[11].parName = "@belief";
            paras[11].objValue = model.Belief;

            paras[12].dbType = SqlDbType.VarChar;
            paras[12].parName = "@birthday";
            paras[12].objValue = model.Birthday;

            paras[13].dbType = SqlDbType.VarChar;
            paras[13].parName = "@lunarCalendar_birth";
            paras[13].objValue = model.LunarCarlendar_birth;

            paras[14].dbType = SqlDbType.VarChar;
            paras[14].parName = "@BirthType";
            paras[14].objValue = model.BirthType;

            paras[15].dbType = SqlDbType.VarChar;
            paras[15].parName = "@departTime";
            paras[15].objValue = model.DepartTime;

            paras[16].dbType = SqlDbType.VarChar;
            paras[16].parName = "@lunarCalendar_depart";
            paras[16].objValue = model.LunarCalendar_depart;

            paras[17].dbType = SqlDbType.VarChar;
            paras[17].parName = "@DepartType";
            paras[17].objValue = model.DepartType;

            paras[18].dbType = SqlDbType.VarChar;
            paras[18].parName = "@surname_Two";
            paras[18].objValue = model.Surname_Two;

            paras[19].dbType = SqlDbType.VarChar;
            paras[19].parName = "@username_Two";
            paras[19].objValue = model.Surname_Two;

            paras[20].dbType = SqlDbType.VarChar;
            paras[20].parName = "@otherName_Two";
            paras[20].objValue = model.OtherName_Two;

            paras[21].dbType = SqlDbType.VarChar;
            paras[21].parName = "@picture_Two";
            paras[21].objValue = model.Picture_Two;

            paras[22].dbType = SqlDbType.VarChar;
            paras[22].parName = "@Sex_Two";
            paras[22].objValue = model.Sex_two;

            paras[23].dbType = SqlDbType.VarChar;
            paras[23].parName = "@nation_Two";
            paras[23].objValue = model.Nation_two;

            paras[24].dbType = SqlDbType.VarChar;
            paras[24].parName = "@place_Two";
            paras[24].objValue = model.Place_Two;

            paras[25].dbType = SqlDbType.VarChar;
            paras[25].parName = "@Occupation_Two";
            paras[25].objValue = model.Occupation_Two;

            paras[26].dbType = SqlDbType.VarChar;
            paras[26].parName = "@belief_Two";
            paras[26].objValue = model.Belief_Two;

            paras[27].dbType = SqlDbType.VarChar;
            paras[27].parName = "@birthday_Two";
            paras[27].objValue = model.Birthday_Two;

            paras[28].dbType = SqlDbType.VarChar;
            paras[28].parName = "@lunarCalendar_birth_Two";
            paras[28].objValue = model.LunarCalendar_birth_Two;

            paras[29].dbType = SqlDbType.VarChar;
            paras[29].parName = "@BirthType_Two";
            paras[29].objValue = model.BirthType_Two;


            paras[30].dbType = SqlDbType.VarChar;
            paras[30].parName = "@departTime_Two";
            paras[30].objValue = model.DepartTime_Two;


            paras[31].dbType = SqlDbType.VarChar;
            paras[31].parName = "@lunarCalendar_depart_Two";
            paras[31].objValue = model.LunarCalendar_depart_Two;

            paras[32].dbType = SqlDbType.VarChar;
            paras[32].parName = "@DepartType_Two";
            paras[32].objValue = model.DepartType_Two;

            paras[33].dbType = SqlDbType.Text;
            paras[33].parName = "@Readme";
            paras[33].objValue = model.Readme;

            paras[34].dbType = SqlDbType.Int;
            paras[34].parName = "@MuType";
            paras[34].objValue = model.MuType;

            paras[35].dbType = SqlDbType.Int;
            paras[35].parName = "@MusicId";
            paras[35].objValue = model.MusicId;

            paras[36].dbType = SqlDbType.DateTime;
            paras[36].parName = "@CreateDate";
            paras[36].objValue = model.CreateDate;

            paras[37].dbType = SqlDbType.Int;
            paras[37].parName = "@province";
            paras[37].objValue = model.Province;

            paras[38].dbType = SqlDbType.Int;
            paras[38].parName = "@city";
            paras[38].objValue = model.City;

            paras[39].dbType = SqlDbType.Decimal;
            paras[39].parName = "@hot";
            paras[39].objValue = model.Hot;

            paras[40].dbType = SqlDbType.VarChar;
            paras[40].parName = "@NetIp";
            paras[40].objValue = model.NetIp;

            paras[41].dbType = SqlDbType.Int;
            paras[41].parName = "@IsCheck";
            paras[41].objValue = model.IsCheck;

            paras[42].dbType = SqlDbType.Int;
            paras[42].parName = "@IsDel";
            paras[42].objValue = model.IsDel;

            paras[43].dbType = SqlDbType.Int;
            paras[43].parName = "@IsIntro";
            paras[43].objValue = model.IsIntro;

            paras[44].dbType = SqlDbType.Int;
            paras[44].parName = "@TemplateId";
            paras[44].objValue = model.TemplateId;


            cmdText = string.Format(cmdText, paras[0].parName, paras[1].parName, paras[2].parName, paras[3].parName, paras[4].parName, paras[5].parName, paras[6].parName, paras[7].parName, paras[8].parName, paras[9].parName, paras[10].parName, paras[11].parName, paras[12].parName, paras[13].parName, paras[14].parName, paras[15].parName, paras[16].parName, paras[17].parName, paras[18].parName, paras[19].parName, paras[20].parName, paras[21].parName, paras[22].parName, paras[23].parName, paras[24].parName, paras[25].parName, paras[26].parName, paras[27].parName, paras[28].parName, paras[29].parName, paras[30].parName, paras[31].parName, paras[32].parName, paras[33].parName, paras[34].parName, paras[35].parName, paras[36].parName, paras[37].parName, paras[38].parName, paras[39].parName, paras[40].parName, paras[41].parName, paras[42].parName, paras[43].parName, paras[44].parName);

            count = dbclass.ExcSql(cmdText, paras);
            return count;
        }


        /// <summary>
        ///  获得用户创建墓
        /// </summary>
        /// <param name="UserId"></param>
        /// <returns></returns>
        public DataTable getMyCreateMetMus(int UserId, string propertyItems)
        {
            List<NetMu_Model> list = new List<NetMu_Model>();
            string cmdText = "select " + propertyItems + " from NetMu where CreateId=@CreateId and IsDel=0 order by id desc";
            db dbclass = new db();
            db.ParameterArry[] paras = new db.ParameterArry[1];
            paras[0].dbType = SqlDbType.Int;
            paras[0].parName = "@CreateId";
            paras[0].objValue = UserId;

            DataTable dataTable = new DataTable();
            dataTable = dbclass.GetSql_DataTable(cmdText, paras);
            return dataTable;
        }




        /// <summary>
        /// 获得墓的详细信息
        /// </summary>
        /// <param name="NetNumId"></param>
        /// <returns></returns>
        public NetMu_Model getNetMuDetailInfo(int NetMuId)
        {
            NetMu_Model model = null;
            string cmdText = "select *from NetMu where id=@id";
            db dbclass = new db();
            db.ParameterArry[] paras = new db.ParameterArry[1];
            paras[0].dbType = SqlDbType.Int;
            paras[0].parName = "@id";
            paras[0].objValue = NetMuId;

            SqlDataReader reader = dbclass.GetSqlDataReader(cmdText, paras);
            if (reader.Read())
            {
                model = new NetMu_Model();
                model.Id = StringHelper.isNumber_int(reader["id"].ToString());
                model.MuId = reader["MuId"].ToString();
                model.MuName = reader["MuName"].ToString();
                model.CreateId = StringHelper.isNumber_int(reader["CreateId"].ToString());
                model.Susername = reader["surname"].ToString();
                model.Username = reader["username"].ToString();
                model.OtherName = reader["otherName"].ToString();
                model.Picture = reader["picture"].ToString();
                model.Sex = reader["Sex"].ToString();
                model.Nation = reader["nation"].ToString();
                model.Place = reader["place"].ToString();
                model.Occupation = reader["Occupation"].ToString();
                model.Belief = reader["belief"].ToString();
                model.Birthday = reader["birthday"].ToString();
                model.LunarCarlendar_birth = reader["lunarCalendar_birth"].ToString();
                model.BirthType = reader["BirthType"].ToString();
                model.DepartTime = reader["departTime"].ToString();
                model.LunarCalendar_depart = reader["lunarCalendar_depart"].ToString();
                model.DepartType = reader["DepartType"].ToString();
                model.Surname_Two = reader["surname_Two"].ToString();
                model.Username_Two = reader["username_Two"].ToString();
                model.OtherName_Two = reader["otherName_Two"].ToString();
                model.Picture_Two = reader["picture_Two"].ToString();
                model.Sex_two = reader["Sex_Two"].ToString();
                model.Nation_two = reader["nation_Two"].ToString();
                model.Place_Two = reader["place_Two"].ToString();
                model.Occupation_Two = reader["Occupation_Two"].ToString();
                model.Belief_Two = reader["belief_Two"].ToString();
                model.Birthday_Two = reader["birthday_Two"].ToString();
                model.LunarCalendar_birth_Two = reader["lunarCalendar_birth_Two"].ToString();
                model.BirthType_Two = reader["BirthType_Two"].ToString();
                model.DepartTime_Two = reader["departTime_Two"].ToString();
                model.LunarCalendar_depart_Two = reader["lunarCalendar_depart_Two"].ToString();
                model.DepartType_Two = reader["DepartType_Two"].ToString();
                model.Readme = reader["Readme"].ToString();
                model.MuType = StringHelper.isNumber_int(reader["MuType"].ToString());
                model.MusicId = StringHelper.isNumber_int(reader["MusicId"].ToString());
                model.CreateDate = DateTime.Parse(reader["CreateDate"].ToString());
                model.Province = Convert.ToInt32(reader["province"].ToString());
                model.City = Convert.ToInt32(reader["city"].ToString());
                model.Hot = Convert.ToInt32(reader["hot"].ToString());
                model.NetIp = reader["NetIp"].ToString();
                model.IsCheck = Convert.ToInt32(reader["IsCheck"].ToString());
                model.IsDel = Convert.ToInt32(reader["IsDel"].ToString());
                model.IsIntro = Convert.ToInt32(reader["IsIntro"].ToString());
                model.TemplateId = Convert.ToInt32(reader["TemplateId"].ToString());
            }
            dbclass.close();
            dbclass.Dispose();

            return model;
        }

        /// <summary>
        /// 删除墓(物理删除)
        /// </summary>
        /// <param name="NetNuId"></param>
        /// <returns></returns>
        public int DeleteNetMu(int NetMuId)
        {
            int count = 0;
            string cmdText = "delete from  NetMu where id=@id";
            db.ParameterArry[] paras = new db.ParameterArry[1];
            paras[0].dbType = SqlDbType.Int;
            paras[0].parName = "@id";
            paras[0].objValue = NetMuId;
            db dbclass = new db();
            count = dbclass.ExcSql(cmdText, paras);
            return count;
        }

        /// <summary>
        /// 隐藏墓(逻辑删除)
        /// </summary>
        /// <param name="NetMuId"></param>
        /// <returns></returns>
        public int HiddenNetMu(int NetMuId)
        {
            int count = 0;
            string cmdText = "update NetMu set IsDel=1 where id=@id";
            db.ParameterArry[] paras = new db.ParameterArry[1];
            paras[0].dbType = SqlDbType.Int;
            paras[0].parName = "@id";
            paras[0].objValue = NetMuId;
            db dbclass = new db();
            count = dbclass.ExcSql(cmdText, paras);
            return count;
        }



        /// <summary>
        /// 审核通过或者取消审核 type=1 代表审核通过 type=0代表取消审核通过
        /// </summary>
        /// <param name="type"></param>
        /// <param name="NetMuId"></param>
        /// <returns></returns>
        public int CheckPassOrCancle(int type, int NetMuId)
        {
            int count = 0;
            string cmdText = "update NetMu set IsCheck=@IsCheck where id=@id";
            db.ParameterArry[] paras = new db.ParameterArry[2];
            paras[0].dbType = SqlDbType.Int;
            paras[0].parName = "@IsCheck";
            paras[0].objValue = type;

            paras[1].dbType = SqlDbType.Int;
            paras[1].parName = "@id";
            paras[1].objValue = NetMuId;

            db dbclass = new db();
            count = dbclass.ExcSql(cmdText, paras);

            return count;
        }


        /// <summary>
        /// 修改公墓信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int updateNetMu(NetMu_Model model)
        {
            int count = 0;
            db dbclass = new db();
            string cmdText = "update NetMu set MuId={0},MuName={1},CreateId={2},surname={3},username={4},otherName={5},picture={6},Sex={7},nation={8},place={9},Occupation={10},belief={11},birthday={12},lunarCalendar_birth={13},BirthType={14},departTime={15},lunarCalendar_depart={16},DepartType={17},surname_Two={18},username_Two={19},otherName_Two={20},picture_Two={21},Sex_Two={22},nation_Two={23},place_Two={24},Occupation_Two={25},belief_Two={26},birthday_Two={27},lunarCalendar_birth_Two={28},BirthType_Two={29},departTime_Two={30},lunarCalendar_depart_Two={31},DepartType_Two={32},Readme={33},MuType={34},MusicId={35},province={36},city={37},hot={38},NetIp={39},IsCheck={40},IsDel={41},TemplateId={42} where id={43}";


            db.ParameterArry[] paras = new db.ParameterArry[44];

            paras[0].dbType = SqlDbType.VarChar;
            paras[0].parName = "@MuId";
            paras[0].objValue = model.MuId;

            paras[1].dbType = SqlDbType.VarChar;
            paras[1].parName = "@MuName";
            paras[1].objValue = model.MuName;

            paras[2].dbType = SqlDbType.Int;
            paras[2].parName = "@CreateId";
            paras[2].objValue = model.CreateId;

            paras[3].dbType = SqlDbType.VarChar;
            paras[3].parName = "@surname";
            paras[3].objValue = model.Susername;

            paras[4].dbType = SqlDbType.VarChar;
            paras[4].parName = "@username";
            paras[4].objValue = model.Username;

            paras[5].dbType = SqlDbType.VarChar;
            paras[5].parName = "@otherName";
            paras[5].objValue = model.OtherName;

            paras[6].dbType = SqlDbType.VarChar;
            paras[6].parName = "@picture";
            paras[6].objValue = model.Picture;


            paras[7].dbType = SqlDbType.VarChar;
            paras[7].parName = "@Sex";
            paras[7].objValue = model.Sex;

            paras[8].dbType = SqlDbType.VarChar;
            paras[8].parName = "@nation";
            paras[8].objValue = model.Nation;

            paras[9].dbType = SqlDbType.VarChar;
            paras[9].parName = "@place";
            paras[9].objValue = model.Place;

            paras[10].dbType = SqlDbType.VarChar;
            paras[10].parName = "@Occupation";
            paras[10].objValue = model.Occupation;

            paras[11].dbType = SqlDbType.VarChar;
            paras[11].parName = "@belief";
            paras[11].objValue = model.Belief;

            paras[12].dbType = SqlDbType.VarChar;
            paras[12].parName = "@birthday";
            paras[12].objValue = model.Birthday;

            paras[13].dbType = SqlDbType.VarChar;
            paras[13].parName = "@lunarCalendar_birth";
            paras[13].objValue = model.LunarCarlendar_birth;

            paras[14].dbType = SqlDbType.VarChar;
            paras[14].parName = "@BirthType";
            paras[14].objValue = model.BirthType;

            paras[15].dbType = SqlDbType.VarChar;
            paras[15].parName = "@departTime";
            paras[15].objValue = model.DepartTime;

            paras[16].dbType = SqlDbType.VarChar;
            paras[16].parName = "@lunarCalendar_depart";
            paras[16].objValue = model.LunarCalendar_depart;

            paras[17].dbType = SqlDbType.VarChar;
            paras[17].parName = "@DepartType";
            paras[17].objValue = model.DepartType;

            paras[18].dbType = SqlDbType.VarChar;
            paras[18].parName = "@surname_Two";
            paras[18].objValue = model.Surname_Two;

            paras[19].dbType = SqlDbType.VarChar;
            paras[19].parName = "@username_Two";
            paras[19].objValue = model.Surname_Two;

            paras[20].dbType = SqlDbType.VarChar;
            paras[20].parName = "@otherName_Two";
            paras[20].objValue = model.OtherName_Two;

            paras[21].dbType = SqlDbType.VarChar;
            paras[21].parName = "@picture_Two";
            paras[21].objValue = model.Picture_Two;

            paras[22].dbType = SqlDbType.VarChar;
            paras[22].parName = "@Sex_Two";
            paras[22].objValue = model.Sex_two;

            paras[23].dbType = SqlDbType.VarChar;
            paras[23].parName = "@nation_Two";
            paras[23].objValue = model.Nation_two;

            paras[24].dbType = SqlDbType.VarChar;
            paras[24].parName = "@place_Two";
            paras[24].objValue = model.Place_Two;

            paras[25].dbType = SqlDbType.VarChar;
            paras[25].parName = "@Occupation_Two";
            paras[25].objValue = model.Occupation_Two;

            paras[26].dbType = SqlDbType.VarChar;
            paras[26].parName = "@belief_Two";
            paras[26].objValue = model.Belief_Two;

            paras[27].dbType = SqlDbType.VarChar;
            paras[27].parName = "@birthday_Two";
            paras[27].objValue = model.Birthday_Two;

            paras[28].dbType = SqlDbType.VarChar;
            paras[28].parName = "@lunarCalendar_birth_Two";
            paras[28].objValue = model.LunarCalendar_birth_Two;

            paras[29].dbType = SqlDbType.VarChar;
            paras[29].parName = "@BirthType_Two";
            paras[29].objValue = model.BirthType_Two;


            paras[30].dbType = SqlDbType.VarChar;
            paras[30].parName = "@departTime_Two";
            paras[30].objValue = model.DepartTime_Two;


            paras[31].dbType = SqlDbType.VarChar;
            paras[31].parName = "@lunarCalendar_depart_Two";
            paras[31].objValue = model.LunarCalendar_depart_Two;

            paras[32].dbType = SqlDbType.VarChar;
            paras[32].parName = "@DepartType_Two";
            paras[32].objValue = model.DepartType_Two;

            paras[33].dbType = SqlDbType.Text;
            paras[33].parName = "@Readme";
            paras[33].objValue = model.Readme;

            paras[34].dbType = SqlDbType.Int;
            paras[34].parName = "@MuType";
            paras[34].objValue = model.MuType;

            paras[35].dbType = SqlDbType.Int;
            paras[35].parName = "@MusicId";
            paras[35].objValue = model.MusicId;

            //paras[36].dbType = SqlDbType.DateTime;
            //paras[36].parName = "@CreateDate";
            //paras[36].objValue = model.CreateDate;

            paras[36].dbType = SqlDbType.Int;
            paras[36].parName = "@province";
            paras[36].objValue = model.Province;

            paras[37].dbType = SqlDbType.Int;
            paras[37].parName = "@city";
            paras[37].objValue = model.City;

            paras[38].dbType = SqlDbType.Decimal;
            paras[38].parName = "@hot";
            paras[38].objValue = model.Hot;

            paras[39].dbType = SqlDbType.VarChar;
            paras[39].parName = "@NetIp";
            paras[39].objValue = model.NetIp;

            paras[40].dbType = SqlDbType.Int;
            paras[40].parName = "@IsCheck";
            paras[40].objValue = model.IsCheck;

            paras[41].dbType = SqlDbType.Int;
            paras[41].parName = "@IsDel";
            paras[41].objValue = model.IsDel;

            paras[42].dbType = SqlDbType.Int;
            paras[42].parName = "@TemplateId";
            paras[42].objValue = model.TemplateId;

            paras[43].dbType = SqlDbType.Int;
            paras[43].parName = "@id";
            paras[43].objValue = model.Id;

            cmdText = string.Format(cmdText, paras[0].parName, paras[1].parName, paras[2].parName, paras[3].parName, paras[4].parName, paras[5].parName, paras[6].parName, paras[7].parName, paras[8].parName, paras[9].parName, paras[10].parName, paras[11].parName, paras[12].parName, paras[13].parName, paras[14].parName, paras[15].parName, paras[16].parName, paras[17].parName, paras[18].parName, paras[19].parName, paras[20].parName, paras[21].parName, paras[22].parName, paras[23].parName, paras[24].parName, paras[25].parName, paras[26].parName, paras[27].parName, paras[28].parName, paras[29].parName, paras[30].parName, paras[31].parName, paras[32].parName, paras[33].parName, paras[34].parName, paras[35].parName, paras[36].parName, paras[37].parName, paras[38].parName, paras[39].parName, paras[40].parName, paras[41].parName, paras[42].parName, paras[43].parName);

            count = dbclass.ExcSql(cmdText, paras);
            return count;
        }


        /// <summary>
        /// 设置推荐或者取消推荐
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="CancleOrIntro">1表示设置推荐 0表示取消推荐</param>
        /// <returns></returns>
        public int SetIntro(int Id, int CancleOrIntro)
        {
            int count = 0;
            string cmdText = "update NetMu set IsIntro=@IsIntro where id=@id";
            db.ParameterArry[] paras = new db.ParameterArry[2];
            paras[0].dbType = SqlDbType.Int;
            paras[0].parName = "@IsIntro";
            paras[0].objValue = CancleOrIntro;

            paras[1].dbType = SqlDbType.Int;
            paras[1].parName = "@id";
            paras[1].objValue = Id;

            db dbclass = new db();
            count = dbclass.ExcSql(cmdText, paras);

            return count;
        }
        /// <summary>
        /// 审核或者取消审核
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="CancleOrIntro">1表示审核 0表示取消审核</param>
        /// <returns></returns>
        public int SetCheck(int Id, int CancleOrIntro)
        {
            int count = 0;
            string cmdText = "update NetMu set IsCheck=@IsCheck where id=@id";
            db.ParameterArry[] paras = new db.ParameterArry[2];
            paras[0].dbType = SqlDbType.Int;
            paras[0].parName = "@IsCheck";
            paras[0].objValue = CancleOrIntro;

            paras[1].dbType = SqlDbType.Int;
            paras[1].parName = "@id";
            paras[1].objValue = Id;

            db dbclass = new db();
            count = dbclass.ExcSql(cmdText, paras);

            return count;
        }

        #region INetMu 成员


        public DataTable GetDataTable(string filter)
        {
            db Conn = new db();
            DataTable dt = new DataTable();
            try
            {
                if (filter + "" != "")
                {
                    filter = "  where " + filter;
                }
                string sqlstr = "Select *  from  NetMu " + filter;
                dt = Conn.GetSql_DataTable(sqlstr);
            }
            catch
            {
                dt = null;
            }
            return dt;
        }


        /// <summary>
        /// 设置背景音乐
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="MusicId"></param>
        /// <returns></returns>
        public int SetMusic(int Id, int MusicId)
        {
            string cmdText = "update NetMu set MusicId=@MusicId where Id=@ID";
            int count = 0;
            db.ParameterArry[] paras = new db.ParameterArry[2];

            paras[0].dbType = SqlDbType.Int;
            paras[0].parName = "@MusicId";
            paras[0].objValue = MusicId;

            paras[1].dbType = SqlDbType.Int;
            paras[1].parName = "@ID";
            paras[1].objValue = Id;

            db dbclass = new db();
            count = dbclass.ExcSql(cmdText, paras);
            return count;

        }

        public void filterUpdate(string Upfilter, string filter)
        {
            db Conn = new db();
            if (filter + "" != "")
            {
                filter = "  where " + filter;
            }
            Conn.Execute_Noget("update NetMu Set " + Upfilter + " " + filter);
            Conn.close();
        }

        #endregion
    }
}
